@echo off
rem setlocal enabledelayedexpansion

REM ====================================================
REM Ask for project name
:G_PROJ_NAME

SET /P projName=Enter the new Project's name: 

REM Check if folder of that name exists
IF NOT EXIST .\%projName%    GOTO G_MAKE_PROJ_DIR

REM Duplicate project name found. Ask for another name
ECHO A project with that name already exists.
ECHO ----------------------------------------
GOTO G_PROJ_NAME


REM ====================================================
REM Create project folders
:G_MAKE_PROJ_DIR

MKDIR .\%projName%
MKDIR .\%projName%\include
MKDIR .\%projName%\src
MKDIR .\%projName%\linker

REM Copy template files over
COPY .\Template\Template.mcp		.\%projName%\%projName%.mcp
COPY .\Template\src\*			.\%projName%\src
COPY .\Template\include\*		.\%projName%\include
COPY .\Template\linker\*		.\%projName%\linker

REM Done
ECHO PIC18 project created successfully. Click any key to exit.
PAUSE